import time
from selenium import webdriver
from selenium.webdriver.edge.service import Service
from lxml import etree

service = Service()
service.path = r'chromedriver.exe'
# 启动浏览器
browser = webdriver.Chrome(service=service)

# 让浏览器发起一个指定url对应请求
browser.get('https://sc.chinaz.com/tupian/')

# page_source 获取浏览器当前页面的页面源码数据
page_text = browser.page_source

with open('1.html','w',encoding='utf-8') as f:
    f.write(page_text)

tree = etree.HTML(page_text)

img = tree.xpath('/html/body/div[3]/div[2]/div[1]/img/@src')

print(img)

# browser.quit()

time.sleep(1)

